*------------------------------------------------------------------------------*
					***FIGURE S6. PLACEBO ELECTION DATES***
*------------------------------------------------------------------------------*

use "${tempdata}kreise_complete_all.dta", clear

keep Incumbent_share PM10_30km_10ug O3_30km_10ug temp_30km humid_rel_30km precip_30km wind_speed_30km pop_tot GDP_capita employment lag_PM10_10ug_1_30km-lag_PM10_10ug_21_30km lead_PM10_10ug_1_30km-lead_PM10_10ug_21_30km turnout kreis_code election_date type samplePM10_allcontrols

*------------------------------------------------------------------------------*

**Label variables
*All days
forval t=1/21 {  // foreach t of local periods
	label variable lag_PM10_10ug_`t'_30km "T-`t'"
	label variable lead_PM10_10ug_`t'_30km "T+`t'"
}

*Election day
label variable PM10_30km_10ug "Election"

*------------------------------------------------------------------------------*

**Macros
local dep_vars "Incumbent_share"
local weather_controls "O3_30km_10ug temp_30km humid_rel_30km precip_30km wind_speed_30km"
local demo_econ_controls "pop_tot GDP_capita employment"


*------------------------------------------------------------------------------*

****Regressions and graphs

**Incumbent - 7 Days before/after election
foreach y of local dep_vars {

	forval t = 1/7 {
	qui reghdfe `y' lag_PM10_10ug_`t'_30km `weather_controls' `demo_econ_controls' turnout, absorb(kreis_code election_date type) vce(cluster kreis_code), if samplePM10_allcontrols == 1
	est store lag`t'_`y'

	qui reghdfe `y' lead_PM10_10ug_`t'_30km `weather_controls' `demo_econ_controls' turnout, absorb(kreis_code election_date type) vce(cluster kreis_code), if samplePM10_allcontrols == 1
	est store lead`t'_`y'
	} // t

	qui reghdfe `y' PM10_30km_10ug `weather_controls' `demo_econ_controls' turnout, absorb(kreis_code election_date type) vce(cluster kreis_code), if samplePM10_allcontrols == 1
	est store T_`y'

	*Graphs
	if "`y'" == "Incumbent_share"{
		coefplot (lag7_`y', pstyle(p2)) (lag6_`y', pstyle(p1)) (lag5_`y', pstyle(p1)) (lag4_`y', pstyle(p1)) (lag3_`y', pstyle(p1)) (lag2_`y', pstyle(p1)) (lag1_`y', pstyle(p1)) (T_`y', pstyle(p3)) ///
			  (lead1_`y', pstyle(p1)) (lead2_`y', pstyle(p1)) (lead3_`y', pstyle(p1)) (lead4_`y', pstyle(p1)) (lead5_`y', pstyle(p1)) (lead6_`y', pstyle(p1)) (lead7_`y', pstyle(p2)), ///
			  vertical drop(`weather_controls' `demo_econ_controls' turnout _cons) ///
			  yline(0) levels(95) xlabel(, labsize(small)) legend(off) ytitle("Change in percentage points") rescale(100) ///
			  xline(8, lpattern(dash) lcolor(blue%20) lwidth(vvthin)) graphregion(color(white)) ///
			  bgcolor(white) name(incumbent, replace) offset(0)
	} // "`y'" == "Incumbent_share"
	
	graph export "${outputs}figure_S6.pdf", replace
	
} // y

estimates clear

*------------------------------------------------------------------------------*

clear

exit
